package com.longge;

import java.util.Arrays;

public class FairCandySwap {

    public int[] fairCandySwap(int[] aliceSizes, int[] bobSizes) {

        int aliceSum = Arrays.stream(aliceSizes).sum();
        int bobSum = Arrays.stream(bobSizes).sum();

        for (int aliceSize : aliceSizes) {
            for (int bobSize : bobSizes) {
                if (aliceSum + bobSize - aliceSize == bobSum + aliceSize - bobSize) {
                    return new int[]{aliceSize, bobSize};
                }
            }
        }
        return new int[]{};

    }
}
